package com.itheima.mapper;

import com.github.pagehelper.Page;
import com.itheima.pojo.Clazz;
import com.itheima.pojo.ClazzQueryParam;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ClazzMapper {

    /**
     * 新增
     *
     * @param clazz
     * @return
     */

    int insert(Clazz clazz);

    /**
     * 查询所有
     *
     * @return
     */
    @Select("select id, name, room, begin_date, end_date, master_id, subject, create_time, update_time from clazz")
    List<Clazz> select();

    Page<Clazz> selectPage(ClazzQueryParam clazzQueryParam);

    @Select("select id, name, room, begin_date, end_date, master_id, subject, create_time, update_time from clazz where id = #{id}")
    Clazz selectById(Integer id);

    int update(Clazz clazz);

    @Delete("delete from clazz where id = #{id}")
    int deleteById(Integer id);
}
